package com.example.demo.service;

import com.example.demo.model.Teacher;
import com.example.demo.repository.TeacherRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class TeacherService {

    @Autowired
    private TeacherRepository studentRepository;

    public List<Teacher> findAll(Teacher student){
        return studentRepository.findAll(Example.of(student));
    }

    public void deleteById(String id) {
        studentRepository.deleteById(id);
    }

    public void save(Teacher s) {
        studentRepository.save(s);
    }

    public Teacher getReferenceById(String id) {
        return studentRepository.getReferenceById(id);
    }
}
